package com.example.nio.netty.protoco.serializer;


import com.alibaba.fastjson.JSON;

public class JsonSerializer implements Serializer {

    @Override
    public byte[] encode(Object o) {
        return JSON.toJSONBytes(o);
    }

    @Override
    public <T> T decode(Class<T> tClass, byte[] bytes) {
        return JSON.parseObject(bytes, tClass);
    }
}
